//package cn.xiaobai.core.handler;
//
//import cn.xiaobai.plugin.core.PluginManger;
//import cn.xiaobai.plugin.core.listener.PluginPostProcessorListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ReflectionUtils;
//
//import java.lang.reflect.Method;
//import java.util.Map;
//
///**
// * 公共控制器后置处理
// * 可以根据插件的状态进行实时更新
// *
// * @Author yangdaji
// * @Date 2023/12/10
// * @PackageName cn.xiaobai.core.handler
// * @ClassName CommonControllerHandler
// */
////@Component
//public class CommonControllerPostProcessor implements PluginPostProcessorListener {
//
//    @Autowired
//    private PluginManger pluginManger;
//
//    @Autowired
//    private MethodRequestHandler methodRequestHandler;
//
//    @Override
//    public void pluginPostProcessor(ConfigurableListableBeanFactory configurableListableBeanFactory) throws RuntimeException {
//        Map<String, Object> pluginBootBeanMap = pluginManger.getPluginBootBeanMap();
//        // 基类接口
//        for (Object bean : pluginBootBeanMap.values()) {
//            Class<?> aClass = bean.getClass();
//            Method init = ReflectionUtils.findMethod(aClass, "init", Map.class);
//            Method start = ReflectionUtils.findMethod(aClass, "start", String.class);
//            Method stop = ReflectionUtils.findMethod(aClass, "stop", String.class);
//            Method unInit = ReflectionUtils.findMethod(aClass, "unInit", String.class);
//            methodRequestHandler.addMethod(bean, init, start, stop, unInit);
//        }
//    }
//
//}
